<?php

abstract class Core_Frontend_Share_View_List extends Dcmp_Component_View {

    protected $pagination = NULL;

    protected function initialize() {
        $this->pagination = new Kd_Html_Pagination();
        parent::initialize();
    }

    public function getPagination() {
        return $this->pagination;
    }

    protected function getPaginationUrl($parameters = NULL) {
        if (is_null($parameters)) {
            $parameters = $this->getRequest()->getAllParameters();
        }
        return $this->getUrl(array_merge($parameters, array('pageindex' => '{index}')));
    }

    protected function buildPagination($pagination) {
        $pagination->setPageIndex($this->getRequest()->getParameter('page', 1))
                   ->setPageSize(20)
                   ->setPageRange(4);
    }

    public function render() {
        $this->buildPagination($this->pagination);
        $this->getTemplate()
        	 ->assign('pagination', $this->getPagination());
        return parent::render();
    }

}